import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        Iterator<Integer> it = list.iterator();
        while(it.hasNext()) {
            System.out.print(it.next() + " ");
        }

       /* for (Integer i:list) {
            System.out.print(i + " ");
        }*/
       /* for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + " ");

        }*/
      //  System.out.println(list);
    }
    public static void main22(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(10);
        myArrayList.add(20);
        myArrayList.add(30);
        myArrayList.add(40);
        myArrayList.add(50);
        myArrayList.remove(20);
        myArrayList.display();
       /* System.out.println(myArrayList.get(4));
        myArrayList.set(0,100);
        System.out.println(myArrayList.get(0));*/
      /*  System.out.println(myArrayList.contains(50));
        System.out.println(myArrayList.indexOf(50));*/
        /*myArrayList.add(60);
        myArrayList.add(5,100);*/
      //  myArrayList.display();
    }
}






/*
public void remove(int key) {
    if(head == null) {
        return;
    }
    if(head.val == key) {
        head = head.next;
        return;
    }

}
private ListNote findPrevKey(int key) {
    ListNote cur = head;
    while(cur.next != null) {
        if(cur.next.val == key){
            return cur;
        }
    }
    return cur;
}
*/
